remove duplicates from the string

Hello everybody,

probably good known question but I haven't found anything similar here:

I have a Buffer with patterns which are separated by a certain character.
I need to remove all duplicates of the patterns.
Is there any chunk of code ready to use or any idea how to use interal dxl commands
to complete this task?

Thanks,
Alex.
SystemAdmin - Thu Feb 21 09:22:56 EST 2013

Re: remove duplicates from the string
doors36677 - Thu Feb 21 09:25:13 EST 2013

Parse the data into a skip list then parse skip list back to buffer

Re: remove duplicates from the string
SystemAdmin - Mon Feb 25 02:23:32 EST 2013

doors36677 - Thu Feb 21 09:25:13 EST 2013
Parse the data into a skip list then parse skip list back to buffer

Thanks a lot. That works just fine!

Re: remove duplicates from the string
llandale - Tue Feb 26 15:33:50 EST 2013

Yes putting in a Skip gets rid of duplicates and also sorts it alphabetically. If you want to preserve the original order, then perhaps:

Skip skpValues = createString() // KEY and DATA both 'string'
 
for each Entry between your delimit character do
{  if (put(skpValues, Entry, Entry)) //
   then this is 1st encounter of Entry, deal with it
   else this is subsequent encounter, ignore it
}
delete(skpValues)


-Louie